@extends('home.layout.base')
<link rel="stylesheet" href="{{URL::asset('./css/hrmy/public.css')}}">

@section('content')
<div class="mainHrContent">
    <div class="storelistTitle">
        <span class="storelistTitle_left">
            <span>
                <img src="{{URL::asset('./img/icon/home.png')}}">
            </span>
            <span><a href="{{route('home.index.index') }}">首页</a> >
                <a href="{{route('home.hrmy.hrIndex') }}">用户中心</a>
                > 收藏的文档
            </span>
        </span>
        <span class="storelistTitle_right">
            <span>找不到合适的供应商？发个需求试试？</span>
            <button @click=" window.location.href = '{{ route('home.demand.demandAdd') }}'">免费发布需求</button>
        </span>
    </div>
    <div class="hrContent">
        @include('home.hrmy.menu')
        <div class="basicInfo" id="hrCollect_goodss">
            <div class="basicInfo_title" style="margin-bottom:0px">
                <span></span>
                收藏的文档
            </div>
            <div class="footprintMian">
                <div class="footprint_word" v-for="item in listData" @click="window.location.href = '{{ route('home.word.wordDetails') }}?id='+item.word_id">
                    <img :src="item.word_thumb">
                    <div>
                        <p class="footprint_title">
                            <span class="footprint_name">@{{item.word_title}}
                            </span>
                        </p>
                        <p class="footprint_wordMes footprint_activityMes">
                            <span>
                                <img src="{{URL::asset('./img/icon/storeListEye.png')}}">
                                @{{item.word_view}}
                            </span>
                            <span>
                                <img src="{{URL::asset('./img/icon/download.png')}}">
                                @{{item.word_download}}
                            </span>
                            <!-- <span>
                                <img src="{{URL::asset('./img/icon/time.png')}}">
                                @{{item.word_download}}
                            </span> -->
                            <span>
                                <img src="{{URL::asset('./img/word/downWord.png')}}" v-if="item.word_format=='doc' || item.word_format=='docx'">
                                <img src="{{URL::asset('./img/word/downExel.png')}}" v-if="item.word_format=='xlsx' || item.word_format=='xls'">
                                <img src="{{URL::asset('./img/word/downPdf.png')}}" v-if="item.word_format=='pdf'">
                            </span>
                        </p>
                    </div>
                    <button @click.stop="deleteCollect(item.id)">
                        取消收藏
                    </button>
                </div>
            </div>
            <div class="elementPage" style="margin-top: 20px;" v-if="pageCount>0">
                <el-pagination :pager-count="5" @current-change="handleCurrentChange" :current-page.sync="pageNumber" background prev-text="上一页" next-text="下一页" layout="prev, pager, next,jumper" :total="pageCount">
                </el-pagination>
            </div>
        </div>
    </div>
</div>
<style>
    .footprint_wordMes.footprint_activityMes {
        display: grid;
        grid-template-columns: repeat(4, 106px);
        grid-column-gap: 10px;
    }

    .footprintMian>div:first-child {
        padding-top: 0px;
    }
</style>
@endsection
@section('compontentScipts')
<script>
    $(() => {
        let hrCollect_goods = new Vue({
            el: '#hrCollect_goodss',
            data: () => {
                return {
                    pageNumber: 1,
                    pageCount: 0,
                    listData: [],
                }
            },
            created() {
                this.getList();
            },
            mounted() {},
            methods: {
                getList() {
                    let data = {
                        page: this.pageNumber,
                        type: 1
                    };
                    apiAjax("{{ route('home.user.hrCollectListApi')}}", 'get', data, (res) => {
                        if (res.code == 0) {
                            this.pageCount = res.data.total;
                            this.listData = res.data.data;
                        } else {
                            this.$message({
                                message: res.msg,
                                type: 'warning'
                            });
                        }
                    }, (erro) => {});
                },
                handleCurrentChange(val) {
                    this.pageNumber = val;
                    this.getList();
                },
                deleteCollect(id) {
                    let data = {
                        collect_id: id,
                        type: 1
                    };
                    apiAjax("{{ route('home.user.hrCollectCancelApi')}}", 'post', data, (res) => {
                        if (res.code == 0) {
                            this.$message({
                                message: res.msg,
                                type: 'success'
                            });
                            this.getList();
                        } else {
                            this.$message({
                                message: res.msg,
                                type: 'warning'
                            });
                        }
                    }, (erro) => {

                    });
                }
            }
        })
    })
</script>
@endsection